package com.lty.controller;

import com.lty.mq.project.RabbitMQProducer;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author lty
 */
@Slf4j
@RestController
@RequestMapping("/rabbitmq")
public class RabbitMQController {

    @Resource
    private RabbitMQProducer rabbitMQProducer;

    @ApiOperation(value = "发送消息到 RabbitMQ 队列")
    @PostMapping("/send")
    public String send(String message) {
        rabbitMQProducer.sendCustomMessage(message);
        return "RabbitMQ send successful!";
    }
}
